<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>std.path</title>
  <link href="./css/style.css" rel="stylesheet" type="text/css"/>
  <!-- <link href="./img/icon.png" rel="icon" type="image/png"/> -->
  <script type="text/javascript" src="./js/jquery.js"></script>
  <script type="text/javascript" src="./js/modules.js"></script>
  <script type="text/javascript" src="./js/quicksearch.js"></script>
  <script type="text/javascript" src="./js/navigation.js"></script>
  <!--<script type="text/javascript" src="./js/jquery.treeview.js"></script>-->
  <script type="text/javascript">
    var g_moduleFQN = "std.path";
  </script>
  
</head>
<body>
<div id="content">
  <h1><a href="./htmlsrc/std.path.html" class="symbol">std.path</a></h1>
  
<dl>
<dt class="decl">char[1] <a class="symbol _variable" name="sep" href="./htmlsrc/std.path.html#L55" kind="variable" beg="55" end="55">sep</a>; <span class="attrs">[<span class="stc">const</span>]</span> <a title="Permalink to this symbol" href="#sep" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L55">#</a></dt>
<dd class="ddef">
<div class="summary">String used to separate directory names in a path. Under
  Windows this is a backslash, under Linux a slash.</div></dd>
<dt class="decl">char[0] <a class="symbol _variable" name="altsep" href="./htmlsrc/std.path.html#L58" kind="variable" beg="58" end="58">altsep</a>; <span class="attrs">[<span class="stc">const</span>]</span> <a title="Permalink to this symbol" href="#altsep" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L58">#</a></dt>
<dd class="ddef">
<div class="summary">Alternate version of sep[] used in Windows (a slash). Under
  Linux this is empty.</div></dd>
<dt class="decl">char[1] <a class="symbol _variable" name="pathsep" href="./htmlsrc/std.path.html#L61" kind="variable" beg="61" end="61">pathsep</a>; <span class="attrs">[<span class="stc">const</span>]</span> <a title="Permalink to this symbol" href="#pathsep" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L61">#</a></dt>
<dd class="ddef">
<div class="summary">Path separator string. A semi colon under Windows, a colon
  under Linux.</div></dd>
<dt class="decl">char[1] <a class="symbol _variable" name="linesep" href="./htmlsrc/std.path.html#L64" kind="variable" beg="64" end="64">linesep</a>; <span class="attrs">[<span class="stc">const</span>]</span> <a title="Permalink to this symbol" href="#linesep" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L64">#</a></dt>
<dd class="ddef">
<div class="summary">String used to separate lines, \r\n under Windows and \n
 under Linux.</div></dd>
<dt class="decl">char[1] <a class="symbol _variable" name="curdir" href="./htmlsrc/std.path.html#L65" kind="variable" beg="65" end="65">curdir</a>; <span class="attrs">[<span class="stc">const</span>]</span> <a title="Permalink to this symbol" href="#curdir" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L65">#</a></dt>
<dd class="ddef">
<div class="summary">String representing the current directory.</div></dd>
<dt class="decl">char[2] <a class="symbol _variable" name="pardir" href="./htmlsrc/std.path.html#L66" kind="variable" beg="66" end="66">pardir</a>; <span class="attrs">[<span class="stc">const</span>]</span> <a title="Permalink to this symbol" href="#pardir" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L66">#</a></dt>
<dd class="ddef">
<div class="summary">String representing the parent directory.</div></dd>
<dt class="decl">alias std.string.cmp <a class="symbol _alias" name="fcmp" href="./htmlsrc/std.path.html#L81" kind="alias" beg="81" end="81">fcmp</a>; <a title="Permalink to this symbol" href="#fcmp" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L81">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">string <a class="symbol _function" name="getExt" href="./htmlsrc/std.path.html#L113" kind="function" beg="113" end="135">getExt</a><span class="params">(string <em>fullname</em>)</span>; <a title="Permalink to this symbol" href="#getExt" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L113">#</a></dt>
<dd class="ddef">
<div class="summary">Extracts the extension from a filename or path.</div>
This function will search fullname from the end until the
 first dot, path separator or first character of fullname is
 reached. Under Windows, the drive letter separator (<i>colon</i>)
 also terminates the search.
<p class="sec_header">Returns:</p>If a dot was found, characters to its right are
 returned. If a path separator was found, or fullname didn't
 contain any dots or path separators, returns null.
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<span class="k">version</span>(<span class="i">Win32</span>)
{
    <span class="i">getExt</span>(<span class="sl">r"d:\path\foo.bat"</span>) <span class="lc">// "bat"</span>
    <span class="i">getExt</span>(<span class="sl">r"d:\path.two\bar"</span>) <span class="lc">// null</span>
}
<span class="k">version</span>(<span class="i">linux</span>)
{
    <span class="i">getExt</span>(<span class="sl">r"/home/user.name/bar."</span>)  <span class="lc">// ""</span>
    <span class="i">getExt</span>(<span class="sl">r"d:\\path.two\\bar"</span>)     <span class="lc">// "two\\bar"</span>
    <span class="i">getExt</span>(<span class="sl">r"/home/user/.resource"</span>)  <span class="lc">// "resource"</span>
}
</pre></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest" href="./htmlsrc/std.path.html#L137" kind="unittest" beg="137" end="175">unittest</a>; <a title="Permalink to this symbol" href="#unittest" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L137">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">string <a class="symbol _function" name="getName" href="./htmlsrc/std.path.html#L207" kind="function" beg="207" end="229">getName</a><span class="params">(string <em>fullname</em>)</span>; <a title="Permalink to this symbol" href="#getName" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L207">#</a></dt>
<dd class="ddef">
<div class="summary">Returns the extensionless version of a filename or path.</div>
This function will search fullname from the end until the
 first dot, path separator or first character of fullname is
 reached. Under Windows, the drive letter separator (<i>colon</i>)
 also terminates the search.
<p class="sec_header">Returns:</p>If a dot was found, characters to its left are
 returned. If a path separator was found, or fullname didn't
 contain any dots or path separators, returns null.
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<p class="error L">std.path(3,39)L: found undefined escape sequence '\p'.</p>
<p class="error L">std.path(9,39)L: found undefined escape sequence '\p'.</p>
<span class="k">version</span>(<span class="i">Win32</span>)
{
    <span class="i">getName</span>(<span class="sl">r"d:\path\foo.bat"</span>) =&gt; <span class="sl">"d:\path\foo"</span>
    <span class="i">getName</span>(<span class="sl">r"d:\path.two\bar"</span>) =&gt; <span class="k">null</span>
}
<span class="k">version</span>(<span class="i">linux</span>)
{
    <span class="i">getName</span>(<span class="sl">"/home/user.name/bar."</span>)  =&gt; <span class="sl">"/home/user.name/bar"</span>
    <span class="i">getName</span>(<span class="sl">r"d:\path.two\bar"</span>) =&gt; <span class="sl">"d:\path"</span>
    <span class="i">getName</span>(<span class="sl">"/home/user/.resource"</span>) =&gt; <span class="sl">"/home/user/"</span>
}
</pre></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:2" href="./htmlsrc/std.path.html#L231" kind="unittest" beg="231" end="247">unittest</a>; <a title="Permalink to this symbol" href="#unittest:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L231">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">string <a class="symbol _function" name="getBaseName" href="./htmlsrc/std.path.html#L275" kind="function" beg="275" end="298">getBaseName</a><span class="params">(string <em>fullname</em>)</span>; <a title="Permalink to this symbol" href="#getBaseName" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L275">#</a></dt>
<dd class="ddef">
<div class="summary">Extracts the base name of a path.</div>
This function will search fullname from the end until the
 first path separator or first character of fullname is
 reached. Under Windows, the drive letter separator (<i>colon</i>)
 also terminates the search.
<p class="sec_header">Returns:</p>If a path separator was found, all the characters to its
 right are returned. Otherwise, fullname is returned.
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<span class="k">version</span>(<span class="i">Win32</span>)
{
    <span class="i">getBaseName</span>(<span class="sl">r"d:\path\foo.bat"</span>) =&gt; <span class="sl">"foo.bat"</span>
}
<span class="k">version</span>(<span class="i">linux</span>)
{
    <span class="i">getBaseName</span>(<span class="sl">"/home/user.name/bar."</span>)  =&gt; <span class="sl">"bar."</span>
}
</pre></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:3" href="./htmlsrc/std.path.html#L300" kind="unittest" beg="300" end="320">unittest</a>; <a title="Permalink to this symbol" href="#unittest:3" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L300">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">string <a class="symbol _function" name="getDirName" href="./htmlsrc/std.path.html#L354" kind="function" beg="354" end="383">getDirName</a><span class="params">(string <em>fullname</em>)</span>; <a title="Permalink to this symbol" href="#getDirName" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L354">#</a></dt>
<dd class="ddef">
<div class="summary">Extracts the directory part of a path.</div>
This function will search fullname from the end until the
 first path separator or first character of fullname is
 reached. Under Windows, the drive letter separator (<i>colon</i>)
 also terminates the search.
<p class="sec_header">Returns:</p>If a path separator was found, all the characters to its
 left are returned. Otherwise, fullname is returned.
<p class="bl"/>
 Under Windows, the found path separator will be included in the
 returned string if it is preceeded by a colon.
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<p class="error L">std.path(3,42)L: found undefined escape sequence '\p'.</p>
<p class="error L">std.path(9,47)L: unterminated string literal.</p>
<span class="k">version</span>(<span class="i">Win32</span>)
{
    <span class="i">getDirName</span>(<span class="sl">r"d:\path\foo.bat"</span>) =&gt; <span class="sl">"d:\path"</span>
    <span class="i">getDirName</span>(<span class="i">getDirName</span>(<span class="sl">r"d:\path\foo.bat"</span>)) =&gt; <span class="sl">"d:\"
}
version(linux)
{
    getDirName("</span>/<span class="i">home</span>/<span class="i">user</span><span class="sl">")  =&gt; "</span>/<span class="i">home</span><span class="sl">"
    getDirName(getDirName("</span>/<span class="i">home</span>/<span class="i">user</span><span class="sl">"))  =&gt; "</span><span class="sl">"
}</span>
</pre></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:4" href="./htmlsrc/std.path.html#L385" kind="unittest" beg="385" end="390">unittest</a>; <a title="Permalink to this symbol" href="#unittest:4" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L385">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">string <a class="symbol _function" name="getDrive" href="./htmlsrc/std.path.html#L410" kind="function" beg="410" end="432">getDrive</a><span class="params">(string <em>fullname</em>)</span>; <a title="Permalink to this symbol" href="#getDrive" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L410">#</a></dt>
<dd class="ddef">
<div class="summary">Extracts the drive letter of a path.</div>
This function will search fullname for a colon from the beginning.
<p class="sec_header">Returns:</p>If a colon is found, all the characters to its left
 plus the colon are returned.  Otherwise, null is returned.
<p class="bl"/>
 Under Linux, this function always returns null immediately.
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<span class="i">getDrive</span>(<span class="sl">r"d:\path\foo.bat"</span>) =&gt; <span class="sl">"d:"</span>
</pre></dd>
<dt class="decl">string <a class="symbol _function" name="defaultExt" href="./htmlsrc/std.path.html#L455" kind="function" beg="455" end="469">defaultExt</a><span class="params">(string <em>filename</em>, string <em>ext</em>)</span>; <a title="Permalink to this symbol" href="#defaultExt" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L455">#</a></dt>
<dd class="ddef">
<div class="summary">Appends a default extension to a filename.</div>
This function first searches filename for an extension and
 appends ext if there is none. ext should not have any leading
 dots, one will be inserted between filename and ext if filename
 doesn't already end with one.
<p class="sec_header">Returns:</p>filename if it contains an extension, otherwise filename
 + ext.
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<span class="i">defaultExt</span>(<span class="sl">"foo.txt"</span>, <span class="sl">"raw"</span>) =&gt; <span class="sl">"foo.txt"</span>
<span class="i">defaultExt</span>(<span class="sl">"foo."</span>, <span class="sl">"raw"</span>) =&gt; <span class="sl">"foo.raw"</span>
<span class="i">defaultExt</span>(<span class="sl">"bar"</span>, <span class="sl">"raw"</span>) =&gt; <span class="sl">"bar.raw"</span>
</pre></dd>
<dt class="decl">string <a class="symbol _function" name="addExt" href="./htmlsrc/std.path.html#L495" kind="function" beg="495" end="513">addExt</a><span class="params">(string <em>filename</em>, string <em>ext</em>)</span>; <a title="Permalink to this symbol" href="#addExt" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L495">#</a></dt>
<dd class="ddef">
<div class="summary">Adds or replaces an extension to a filename.</div>
This function first searches filename for an extension and
 replaces it with ext if found.  If there is no extension, ext
 will be appended. ext should not have any leading dots, one will
 be inserted between filename and ext if filename doesn't already
 end with one.
<p class="sec_header">Returns:</p>filename + ext if filename is extensionless. Otherwise
 strips filename's extension off, appends ext and returns the
 result.
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<span class="i">addExt</span>(<span class="sl">"foo.txt"</span>, <span class="sl">"raw"</span>) =&gt; <span class="sl">"foo.raw"</span>
<span class="i">addExt</span>(<span class="sl">"foo."</span>, <span class="sl">"raw"</span>) =&gt; <span class="sl">"foo.raw"</span>
<span class="i">addExt</span>(<span class="sl">"bar"</span>, <span class="sl">"raw"</span>) =&gt; <span class="sl">"bar.raw"</span>
</pre></dd>
<dt class="decl">int <a class="symbol _function" name="isabs" href="./htmlsrc/std.path.html#L541" kind="function" beg="541" end="551">isabs</a><span class="params">(string <em>path</em>)</span>; <a title="Permalink to this symbol" href="#isabs" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L541">#</a></dt>
<dd class="ddef">
<div class="summary">Checks if path is absolute.</div>
<p class="sec_header">Returns:</p>non-zero if the path starts from the root directory (Linux) or
 drive letter and root directory (Windows),
 zero otherwise.
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<span class="k">version</span>(<span class="i">Win32</span>)
{
    <span class="i">isabs</span>(<span class="sl">r"relative\path"</span>) =&gt; <span class="n">0</span>
    <span class="i">isabs</span>(<span class="sl">r"\relative\path"</span>) =&gt; <span class="n">0</span>
    <span class="i">isabs</span>(<span class="sl">r"d:\absolute"</span>) =&gt; <span class="n">1</span>
}
<span class="k">version</span>(<span class="i">linux</span>)
{
    <span class="i">isabs</span>(<span class="sl">"/home/user"</span>) =&gt; <span class="n">1</span>
    <span class="i">isabs</span>(<span class="sl">"foo"</span>) =&gt; <span class="n">0</span>
}
</pre></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:5" href="./htmlsrc/std.path.html#L553" kind="unittest" beg="553" end="568">unittest</a>; <a title="Permalink to this symbol" href="#unittest:5" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L553">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">string <a class="symbol _function" name="join" href="./htmlsrc/std.path.html#L596" kind="function" beg="596" end="654">join</a><span class="params">(string <em>p1</em>, string <em>p2</em>)</span>; <a title="Permalink to this symbol" href="#join" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L596">#</a></dt>
<dd class="ddef">
<div class="summary">Joins two path components.</div>
If p1 doesn't have a trailing path separator, one will be appended
 to it before concatting p2.
<p class="sec_header">Returns:</p>p1 ~ p2. However, if p2 is an absolute path, only p2
 will be returned.
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<span class="k">version</span>(<span class="i">Win32</span>)
{
    <span class="i">join</span>(<span class="sl">r"c:\foo"</span>, <span class="sl">"bar"</span>) =&gt; <span class="sl">"c:\foo\bar"</span>
    <span class="i">join</span>(<span class="sl">"foo"</span>, <span class="sl">r"d:\bar"</span>) =&gt; <span class="sl">"d:\bar"</span>
}
<span class="k">version</span>(<span class="i">linux</span>)
{
    <span class="i">join</span>(<span class="sl">"/foo/"</span>, <span class="sl">"bar"</span>) =&gt; <span class="sl">"/foo/bar"</span>
    <span class="i">join</span>(<span class="sl">"/foo"</span>, <span class="sl">"/bar"</span>) =&gt; <span class="sl">"/bar"</span>
}
</pre></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:6" href="./htmlsrc/std.path.html#L656" kind="unittest" beg="656" end="734">unittest</a>; <a title="Permalink to this symbol" href="#unittest:6" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L656">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _function" name="fncharmatch" href="./htmlsrc/std.path.html#L762" kind="function" beg="762" end="780">fncharmatch</a><span class="params">(dchar <em>c1</em>, dchar <em>c2</em>)</span>; <a title="Permalink to this symbol" href="#fncharmatch" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L762">#</a></dt>
<dd class="ddef">
<div class="summary">Matches filename characters.</div>
Under Windows, the comparison is done ignoring case. Under Linux
 an exact match is performed.
<p class="sec_header">Returns:</p>non zero if c1 matches c2, zero otherwise.
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<span class="k">version</span>(<span class="i">Win32</span>)
{
    <span class="i">fncharmatch</span>(<span class="cl">'a'</span>, <span class="cl">'b'</span>) =&gt; <span class="n">0</span>
    <span class="i">fncharmatch</span>(<span class="cl">'A'</span>, <span class="cl">'a'</span>) =&gt; <span class="n">1</span>
}
<span class="k">version</span>(<span class="i">linux</span>)
{
    <span class="i">fncharmatch</span>(<span class="cl">'a'</span>, <span class="cl">'b'</span>) =&gt; <span class="n">0</span>
    <span class="i">fncharmatch</span>(<span class="cl">'A'</span>, <span class="cl">'a'</span>) =&gt; <span class="n">0</span>
}
</pre></dd>
<dt class="decl">int <a class="symbol _function" name="fnmatch" href="./htmlsrc/std.path.html#L829" kind="function" beg="829" end="930">fnmatch</a><span class="params">(string <em>filename</em>, string <em>pattern</em>)</span>; <a title="Permalink to this symbol" href="#fnmatch" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L829">#</a></dt>
<dd class="ddef">
<div class="summary">Matches a pattern against a filename.</div>
Some characters of pattern have special a meaning (they are
 <i>meta-characters</i>) and <b>can't</b> be escaped. These are:
 <p><table>
 <tr><td><b>*</b></td>
     <td>Matches 0 or more instances of any character.</td></tr>
 <tr><td><b>?</b></td>
     <td>Matches exactly one instances of any character.</td></tr>
 <tr><td><b>[</b><i>chars</i><b>]</b></td>
     <td>Matches one instance of any character that appears
     between the brackets.</td></tr>
 <tr><td><b>[!</b><i>chars</i><b>]</b></td>
     <td>Matches one instance of any character that does not appear
     between the brackets after the exclamation mark.</td></tr>
 </table><p>
 Internally individual character comparisons are done calling
 fncharmatch(), so its rules apply here too. Note that path
 separators and dots don't stop a meta-character from matching
 further portions of the filename.
<p class="sec_header">Returns:</p>non zero if pattern matches filename, zero otherwise.
<p class="sec_header">See Also:</p>fncharmatch().
<p class="sec_header">Throws:</p>Nothing.
<p class="sec_header">Examples:</p><pre class="d_code">
<span class="k">version</span>(<span class="i">Win32</span>)
{
    <span class="i">fnmatch</span>(<span class="sl">"foo.bar"</span>, <span class="sl">"*"</span>) =&gt; <span class="n">1</span>
    <span class="i">fnmatch</span>(<span class="sl">r"foo/foo\bar"</span>, <span class="sl">"f*b*r"</span>) =&gt; <span class="n">1</span>
    <span class="i">fnmatch</span>(<span class="sl">"foo.bar"</span>, <span class="sl">"f?bar"</span>) =&gt; <span class="n">0</span>
    <span class="i">fnmatch</span>(<span class="sl">"Goo.bar"</span>, <span class="sl">"[fg]???bar"</span>) =&gt; <span class="n">1</span>
    <span class="i">fnmatch</span>(<span class="sl">r"d:\foo\bar"</span>, <span class="sl">"d*foo?bar"</span>) =&gt; <span class="n">1</span>
}
<span class="k">version</span>(<span class="i">linux</span>)
{
    <span class="i">fnmatch</span>(<span class="sl">"Go*.bar"</span>, <span class="sl">"[fg]???bar"</span>) =&gt; <span class="n">0</span>
    <span class="i">fnmatch</span>(<span class="sl">"/foo*home/bar"</span>, <span class="sl">"?foo*bar"</span>) =&gt; <span class="n">1</span>
    <span class="i">fnmatch</span>(<span class="sl">"foobar"</span>, <span class="sl">"foo?bar"</span>) =&gt; <span class="n">1</span>
}
</pre></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:7" href="./htmlsrc/std.path.html#L932" kind="unittest" beg="932" end="957">unittest</a>; <a title="Permalink to this symbol" href="#unittest:7" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L932">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">string <a class="symbol _function" name="expandTilde" href="./htmlsrc/std.path.html#L1018" kind="function" beg="1018" end="1042">expandTilde</a><span class="params">(string <em>inputPath</em>)</span>; <a title="Permalink to this symbol" href="#expandTilde" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L1018">#</a></dt>
<dd class="ddef">
<div class="summary">Performs tilde expansion in paths.</div>
There are two ways of using tilde expansion in a path. One
 involves using the tilde alone or followed by a path separator. In
 this case, the tilde will be expanded with the value of the
 environment variable <i>HOME</i>.  The second way is putting
 a username after the tilde (i.e. <tt>~john/Mail</tt>). Here,
 the username will be searched for in the user database
 (i.e. <tt>/etc/passwd</tt> on Unix systems) and will expand to
 whatever path is stored there.  The username is considered the
 string after the tilde ending at the first instance of a path
 separator.
<p class="bl"/>
 Note that using the <i>~user</i> syntax may give different
 values from just <i>~</i> if the environment variable doesn't
 match the value stored in the user database.
<p class="bl"/>
 When the environment variable version is used, the path won't
 be modified if the environment variable doesn't exist or it
 is empty. When the database version is used, the path won't be
 modified if the user doesn't exist in the database or there is
 not enough memory to perform the query.
<p class="sec_header">Returns:</p>inputPath with the tilde expanded, or just inputPath
 if it could not be expanded.
 For Windows, expandTilde() merely returns its argument inputPath.
<p class="sec_header">Throws:</p>std.outofmemory.OutOfMemoryException if there is not enough
 memory to perform
 the database lookup for the <i>~user</i> syntax.
<p class="sec_header">Examples:</p><pre class="d_code">
<span class="k">import</span> <span class="i">std</span>.<span class="i">path</span>;

<span class="k">void</span> <span class="i">process_file</span>(<span class="i">string</span> <span class="i">filename</span>)
{
    <span class="i">string</span> <span class="i">path</span> = <span class="i">expandTilde</span>(<span class="i">filename</span>);
    ...
}
</pre>
<p class="bl"/>
 <pre class="d_code">
<span class="k">import</span> <span class="i">std</span>.<span class="i">path</span>;

<span class="k">const</span> <span class="i">string</span> <span class="i">RESOURCE_DIR_TEMPLATE</span> = <span class="sl">"~/.applicationrc"</span>;
<span class="i">string</span> <span class="i">RESOURCE_DIR</span>;    <span class="lc">// This gets expanded in main().</span>

<span class="k">int</span> <span class="i">main</span>(<span class="i">string</span>[] <span class="i">args</span>)
{
    <span class="i">RESOURCE_DIR</span> = <span class="i">expandTilde</span>(<span class="i">RESOURCE_DIR_TEMPLATE</span>);
    ...
}
</pre>
<p class="sec_header">Version:</p>Available since v0.143.
<p class="sec_header">Authors:</p>Grzegorz Adam Hankiewicz, Thomas Kühne.</dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:8" href="./htmlsrc/std.path.html#L1045" kind="unittest" beg="1045" end="1082">unittest</a>; <a title="Permalink to this symbol" href="#unittest:8" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L1045">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">string <a class="symbol _function" name="expandFromEnvironment" href="./htmlsrc/std.path.html#L1090" kind="function" beg="1090" end="1101">expandFromEnvironment</a><span class="params">(string <em>path</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#expandFromEnvironment" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L1090">#</a></dt>
<dd class="ddef">
<div class="summary">Replaces the tilde from path with the environment variable HOME.</div></dd>
<dt class="decl">string <a class="symbol _function" name="combineCPathWithDPath" href="./htmlsrc/std.path.html#L1111" kind="function" beg="1111" end="1132">combineCPathWithDPath</a><span class="params">(char* <em>c_path</em>, string <em>path</em>, int <em>char_pos</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#combineCPathWithDPath" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L1111">#</a></dt>
<dd class="ddef">
<div class="summary">Joins a path from a C string to the remainder of path.</div>
The last path separator from c_path is discarded. The result
 is joined to path[char_pos .. length] if char_pos is smaller
 than length, otherwise path is not appended to c_path.</dd>
<dt class="decl">string <a class="symbol _function" name="expandFromDatabase" href="./htmlsrc/std.path.html#L1138" kind="function" beg="1138" end="1202">expandFromDatabase</a><span class="params">(string <em>path</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#expandFromDatabase" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.path.html#L1138">#</a></dt>
<dd class="ddef">
<div class="summary">Replaces the tilde from path with the path from the user database.</div></dd></dl>
</div>
<div id="footer">
  <p>Placed into public domain.
	www.digitalmars.com

 Grzegorz Adam Hankiewicz added some documentation.

 This module is used to parse file names. All the operations
 work only on strings; they don't perform any input/output
 operations. This means that if a path contains a directory name
 with a dot, functions like getExt() will work with it just as
 if it was a file. To differentiate these cases,
 use the std.file module first (i.e. std.file.isDir()).</p>
  <p>Page generated by <a href="http://code.google.com/p/dil">dil</a> on Fri Dec 26 03:40:09 2008. Rendered by <a href="http://code.google.com/p/dil/wiki/Kandil">kandil</a>.</p>
</div>
</body>
</html>